package com.divineryang.service.impl;

import com.divineryang.mapper.UserAddressMapper;
import com.divineryang.service.UserAddressService;
import org.divineryang.model.entity.user.UserAddress;
import org.divineryang.utils.AuthContextUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Diviner Yang
 * @version V1.0
 * @Package com.divineryang.service.impl
 * @date 2024/5/5 15:12
 */
@Service
public class UserAddressServiceImpl implements UserAddressService {

    @Autowired
    private UserAddressMapper userAddressMapper;

    @Override
    public List<UserAddress> findUserAddressList() {
        Long userId = AuthContextUtil.getUserInfo().getId();
        return userAddressMapper.findByUserId(userId);
    }

    @Override
    public UserAddress getById(Long id) {
       return userAddressMapper.getById(id);
    }
}
